import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";
import autoImport from "./.eslintrc-auto-import.mjs";

export default [
  { files: ["**/*.{js,mjs,cjs,ts,vue}"] },
  {
    languageOptions: {
      globals: { ...globals.browser, ...globals.node, ...autoImport.globals },
    },
  },
  // autoImport,
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended,
  ...pluginVue.configs["flat/essential"],
  {
    files: ["**/*.vue"],
    languageOptions: {
      parserOptions: {
        parser: tseslint.parser,
        sourceType: "module",
        ecmaVersion: "latest",
      },
    },
  },
  {
    ignores: [
      "node_modules",
      "*.md",
      ".vscode",
      ".idea",
      "dist",
      "/public",
      "/docs",
      ".husky",
      ".local",
      "/bin",
      "types/.eslintrc-auto-import",
    ],
  },
  {
    rules: {
      "@typescript-eslint/no-explicit-any": "off",
      "vue/multi-word-component-names": "off",
      // "vue/multi-word-component-names": [
      //   "error",
      //   {
      //     ignores: ["index", "Header"], //需要忽略的组件名
      //   },
      // ],
    },
  },
];
